#ifndef __CMD_DB_WORKER_HPP__
#define __CMD_DB_WORKER_HPP__

#include "vty.hpp"  /* FIXME WriteFunction */
#include "vty_ipc_msg.hpp"
#include "ipc_session.hpp"
#include "command_manager_if.hpp"

class cmd_db_worker
:public boost::enable_shared_from_this<cmd_db_worker>,
private boost::noncopyable       
{
public:
    cmd_db_worker(int id, command_agent_if_ptr agent);
    ~cmd_db_worker();

	void reg_write_func(WriteFunction func);
	void handle_ingress_msg(vty_ipc_message_t& msg);
    

    bool send_ipc(const ipc_message& msg);
    bool send_ipc(const std::string msg);
    bool send_ipc(const char* data, std::size_t size); 

private:
    __u32 handle_rq_add_cmd(string_vector& opts);
    __u32 handle_rq_add_mode(string_vector& opts);
    

    int _id;
    WriteFunction   _send_ipc;
    vty_ipc_msg     _ipcmsg;
    vty_ipc_message_t   _msg;
    command_agent_if_ptr _cmdagent;
};

typedef boost::shared_ptr<cmd_db_worker> cmd_db_worker_ptr;

#endif /* end __CMD_DB_WORKER_HPP__ */
